<?php 
if($type=='add' || $type=='update')
{
	echo '{';
	echo '"state":"'.$result.'",';

	$tag_id_string = '';
	$tag_string = '';
	for ($i=0; $i<count($tag_list); $i++)
	{
		$tag_string = $tag_string.($i==0 ? '' : ',').'"'.$tag_list[$i]->tagName.'"';
		$tag_id_string = $tag_id_string.($i==0 ? '' : ',').$tag_list[$i]->tagId;
	}	
	
	echo '"tag":['.$tag_string.']';
	echo ',"tagId":['.$tag_id_string.']';
	
	echo '}';
}
else if($type=='del')
{
	echo $result;		
}
?>